Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add serial::Read/Write implementation #9

Merged
merged 7 commits into from Jun 16, 2019

Conversation

rnestler
Copy link
Contributor

@rnestler rnestler commented Jun 9, 2018

So this is just a quick PoC to implement #8.
@japaric Do you think it would be OK to implement it in that way? If yes I can finish it up.

@rnestler rnestler changed the title WIP: Add serial::Read implementation WIP: Add serial::Read/Write implementation Jun 13, 2018
@posborne
Copy link
Member

CC @rust-embedded/embedded-linux

@posborne posborne self-requested a review August 15, 2018 04:29
@hannobraun
Copy link
Member

@posborne You assigned yourself as reviewer a while ago. Have you had a chance to review this PR?

@hannobraun hannobraun added the S-waiting-on-review Status: Review is incomplete label Oct 10, 2018
bors bot added a commit that referenced this pull request Oct 29, 2018
12: Release new Patch on crates.io with InputPin Support r=therealprof a=Caemor

Since #9 still seems to be WIP a small update for crates.io would be nice, so I could move back to the crates.io version of this package.

Co-authored-by: Chris <caemor@users.noreply.github.com>
Co-authored-by: Chris <github@caemor.de>
@ryankurte
Copy link
Contributor

Hi hi, sorry this has taken so long, seems like a good addition to me ^_^

Copy link
Member

@hannobraun hannobraun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnestler @ryankurte
My comment here was mostly a drive-by comment to figure out why this is stalled. I'm not very familiar with linux-embedded-hal (or embedded Linux in general), but the various unwraps stood out to me (see comments).

src/serial_impl.rs Outdated Show resolved Hide resolved
src/serial_impl.rs Outdated Show resolved Hide resolved
src/serial_impl.rs Outdated Show resolved Hide resolved
@rnestler
Copy link
Contributor Author

My comment here was mostly a drive-by comment to figure out why this is stalled. I'm not very familiar with linux-embedded-hal (or embedded Linux in general), but the various unwraps stood out to me (see comments).

Yes, that's what I mean with "this is just a quick PoC" 😉 I wanted some general feedback first before I spend time cleaning it up.

do you have a public example using this that we could have look at?

I think I used it on a Raspberry Pi. I can try to come up with example code that uses it.

posborne
posborne previously approved these changes Feb 11, 2019
Copy link
Member

@posborne posborne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got buried but this seems good to me so approved from my perspective. I would like a review from the HAL team as I'm not quite as up to date on the current discussions around the traits.

src/serial_impl.rs Outdated Show resolved Hide resolved
@mathk mathk added S-waiting-on-author Status: Author needs to make changes and removed S-waiting-on-review Status: Review is incomplete labels Feb 22, 2019
Copy link
Contributor

@dbrgn dbrgn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The serial crate has been split up, we should depend on serial_core instead. You can apply this commit (git apply patch.diff): https://gist.github.com/dbrgn/3f3509acbb8cc9fdde229138858e5d0d

(Edit: Disregard what I wrote, the patch is wrong because SerialPort is a trait object. However, we can use serial_unix instead of serial, which simplifies a few things. I'll create a new patch soon.)

src/lib.rs Outdated Show resolved Hide resolved
src/serial_impl.rs Outdated Show resolved Hide resolved
@dbrgn
Copy link
Contributor

dbrgn commented May 19, 2019

@rnestler I continued with your branch (after rebasing it against master), see commits here: https://github.com/dbrgn/linux-embedded-hal/commits/implement-serial Feel free to pull them into your branch.

The overall implementation seems to work fine, I'm using it successfully here.

Regarding the tests, I finished the openpty based implementation, but I lack the knowledge of how PTYs work to make the read call return anything. Right now I can write to the pseudo-terminal, but reading results in a timeout.

Would be great if we could get this merged soon after resolving that blocker.

@rnestler
Copy link
Contributor Author

@dbrgn I integrated your commits and implemented some proper tests using the openpty crate. This lead to me discovering that the errors weren't mapped properly.
I may need to rebase and clean up the history a bit if this is important to the maintainers.

@dbrgn
Copy link
Contributor

dbrgn commented Jun 6, 2019

@rnestler what's the status on this?

@rnestler rnestler force-pushed the implement-serial branch 2 times, most recently from 96e8151 to ba9b608 Compare June 6, 2019 16:05
@rnestler
Copy link
Contributor Author

rnestler commented Jun 6, 2019

Ready for review on my side.

@rnestler rnestler changed the title WIP: Add serial::Read/Write implementation Add serial::Read/Write implementation Jun 6, 2019
ryankurte
ryankurte previously approved these changes Jun 8, 2019
Copy link
Contributor

@ryankurte ryankurte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks for all your effort ^_^

@ryankurte
Copy link
Contributor

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 8, 2019

👎 Rejected by code reviews

@ryankurte
Copy link
Contributor

whoops, boop @dbrgn

rnestler and others added 7 commits June 8, 2019 17:02
By not using the platform-independent implementation, we can simplify
some things.
This allows a user to directly use Serial::open without needing to now
about serial_unix::TTYPort.
Copy link
Contributor

@dbrgn dbrgn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍 Thanks.

@posborne
Copy link
Member

LGTM. bors r+

@rnestler
Copy link
Contributor Author

Hmm bors doesn't seem to approve...

@rnestler
Copy link
Contributor Author

@posborne What is the status on this?

@ryankurte
Copy link
Contributor

ahh, iirc bors commands have to be on their own line?

bors r+

bors bot added a commit that referenced this pull request Jun 16, 2019
9: Add serial::Read/Write implementation r=ryankurte a=rnestler

So this is just a quick PoC to implement #8.
@japaric Do you think it would be OK to implement it in that way? If yes I can finish it up.

Co-authored-by: Raphael Nestler <raphael.nestler@gmail.com>
Co-authored-by: Raphael Nestler <raphael.nestler@sensirion.com>
Co-authored-by: Danilo Bargen <mail@dbrgn.ch>
@bors
Copy link
Contributor

bors bot commented Jun 16, 2019

Build succeeded

@bors bors bot merged commit b4239f1 into rust-embedded:master Jun 16, 2019
@rnestler rnestler deleted the implement-serial branch June 16, 2019 08:14
@dbrgn
Copy link
Contributor

dbrgn commented Jun 16, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: Author needs to make changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants